package com.nanmeishu.springdatajpa.jpademo.dao;

import com.nanmeishu.springdatajpa.jpademo.entity.User;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public class UserDaoImpl implements UserDao {

    //使用jpa技术
    @PersistenceContext
    private EntityManager entityManager;

    @Override
    public User myUserById(int id) {
        String jpsl="select u from User u where u.id=?1";
        return entityManager.find(User.class,id);
    }
}
